import api from "../../utils/api_util";
import baseUtil from "../../utils/base_util";

const app = getApp()
Page({
    data: {
        StatusBar: app.globalData.StatusBar,
        CustomBar: app.globalData.CustomBar,
        userInfo:'',
        earningAccount:'',
    },

    onShow: function (options) {
        this.getUserData();
        this.getEarningAccount();
    },
    //获取用户信息
    getUserData: function () {
        let that = this;
        api.wxRequest.apiRequest(that, api.urls.userInfo, {
            method: 'GET',
            data: {
                v: '1.0.0',
            },
            success: function (res) {
                that.setData({
                    userInfo: res.data,
                })

            },
        })
    },
    //团队、个人收益
    getEarningAccount: function () {
        let that = this;
        api.wxRequest.apiRequest(that, api.urls.earningAccount, {
            method: 'GET',
            data: {
                v: '1.0.0',
            },
            success: function (res) {
                that.setData({
                    earningAccount: res.data,
                })

            },
        })
    },
    //剪贴板
    setCopyText:function (e) {
        let copyText = e.currentTarget.dataset.text;
        wx.setClipboardData({
            data: copyText,
            success(res) {
                wx.getClipboardData({
                    success(res) {
                        console.log(res.data) // data
                    }
                })
            }
        })
    }
})